Imports Clo = Enhancements.Core.Logging
Imports Fun = Enhancements.Basic.Expressions.Functions
Imports Ref = System.Reflection
Imports Sys = System

Namespace Enhancements.Basic.Expressions
    ''' <summary>The exception that is thrown when an expression variable's value is not valid.</summary>
    <Serializable(), DebuggerStepThrough()> _
    Public NotInheritable Class ExpressionVariableValueIsValidNotException
        Inherits Exception

        Private Sub New(ByVal _expression As Expression, ByVal _variable As ExpressionVariable, ByVal _value As Sys.Object)
            Expression = _expression
            Variable = _variable
            Value = _value
        End Sub

        Private __Expression As Expression = Nothing
        ''' <summary>Gets the expression that caused this exception.</summary>
        Public Property Expression() As Expression
            Get
                Return __Expression
            End Get
            Private Set(ByVal _value As Expression)
                __Expression = _value
            End Set
        End Property

        Private __Variable As ExpressionVariable = Nothing
        ''' <summary>Gets the variable that caused this exception.</summary>
        Public Property Variable() As ExpressionVariable
            Get
                Return __Variable
            End Get
            Private Set(ByVal _value As ExpressionVariable)
                __Variable = _value
            End Set
        End Property

        Private __Value As System.Object = Nothing
        ''' <summary>Gets the value that caused this exception.</summary>
        Public Property Value() As System.Object
            Get
                Return __Value
            End Get
            Private Set(ByVal _value As System.Object)
                __Value = _value
            End Set
        End Property

        ''' <summary>Throws an exception.</summary>
        ''' <param name="_expression">Expression that is causing the exception.</param>
        ''' <param name="_variable">Variable that is causing the exception.</param>
        ''' <param name="_value">Value that is causing the exception.</param>
        ''' <exception cref="ExpressionVariableValueIsValidNotException"> </exception>
        Friend Shared Sub ___Throw(ByVal _expression As Expression, ByVal _variable As ExpressionVariable, ByVal _value As Sys.Object)
            Dim _exception As ExpressionVariableValueIsValidNotException = New ExpressionVariableValueIsValidNotException(_expression, _variable, _value)

            Throw _exception
        End Sub

    End Class
End Namespace
